package com.dmn.gcode.springchains.adapters;

import com.dmn.gcode.springchains.core.In;

import java.util.Set;
import java.util.TreeSet;

/**
 * date 1/21/11
 *
 * @author dvponomarev
 * @version 1.0
 */
public class SetAdapter<T> implements In<Set<T>> {
    private Set<In<T>> set;

    public void setSet(Set<In<T>> set) {
        this.set = set;
    }

    public Set<T> get() {
        if (set == null) {
            return null;
        }
        Set<T> result = new TreeSet<T>();
        for (In<T> element : set) {
            result.add(element.get());
        }
        return result;
    }
}
